package com.ocom.aiotweb.controller;

import com.ocom.aiotweb.service.ConsumeUpgradePageService;
import com.ocom.aiotweb.vo.consumeupgradepage.ImportUpgradeVo;
import com.ocom.aiotweb.vo.consumeupgradepage.OnShowVo;
import com.ocom.common.constant.AiotUrl;
import com.ocom.common.resp.Result;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
public class ConsumeUpgradePageController {

    private final Logger log = LoggerFactory.getLogger(ConsumeUpgradePageController.class);
    @Autowired
    private ConsumeUpgradePageService consumeUpgradePageService;

    // 消费升级文件列表（ConsumeUpgradePage/onShow）
    @PostMapping(AiotUrl.URL_Aiot_ConsumeUpgradePageOnShow)
    public Result ConsumeUpgradePageOnShow(@Validated @RequestBody OnShowVo onShowVo){

        return consumeUpgradePageService.ConsumeUpgradePageOnShow(onShowVo);
    }

    /**
     *  文件上传（ConsumeUpgradePage/importUpgrade）
     * */
    @PostMapping(AiotUrl.URL_Aiot_ConsumeUpgradePageImportUpgrade)
    public Result ConsumeUpgradePageImportUpgrade(@Validated @RequestBody ImportUpgradeVo importUpgradeVo){
        return consumeUpgradePageService.ConsumeUpgradePageImportUpgrade(importUpgradeVo);
    }

    // 2.5.3升级文件删除（ConsumeUpgradePage/delete）
    @PostMapping(AiotUrl.URL_Aiot_ConsumeUpgradePageDelete)
    public Result ConsumeUpgradePageDelete(Integer id){
        return consumeUpgradePageService.ConsumeUpgradePageDelete(id);
    }

}
